
import cv2
import os
import numpy as np
# from PIL import Image

filePath=r"/media/jolly/HIK/CorsicanFire/BoFire/label/predictResult"
destPath=r"/media/jolly/HIK/CorsicanFire/BoFire/label/predictResult1"
files=os.listdir(filePath)

for file in files:

    img=cv2.imdecode(np.fromfile(os.path.join(filePath,file),dtype=np.uint8),cv2.IMREAD_COLOR)
    # img = Image.open(os.path.join(filePath,file))
    # img = img.convert('RGB')
    #尺寸变换
    # img=cv2.resize(img,(256,256))

    img[img>=1]=255

    cv2.imencode(".png", img)[1].tofile(os.path.join(destPath,file.replace("jpg","png")))


